package com.project.school_flate.entity.flow;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.*;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.project.school_flate.entity.order.OrderTakeaway;
import com.project.school_flate.entity.user.UserInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "平台流水表")
@Table(value = "t_flow_money")
public class FlowMoney implements Serializable {
    private static final long serialVersionUID = -2874254196443421791L;
    /**
     * ID
     */
    @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
    @Schema(description = "id")
    private String id;

    /**
     * 客户ID
     */
    @Column("user_id")
    @Schema(description = "客户ID")
    private String userId;

    /**
     * 商店ID
     */
    @Column("shop_id")
    @Schema(description = "商店ID")
    private String shopId;

    /**
     * 骑手ID
     */
    @Column("delivery_id")
    @Schema(description = "骑手ID")
    private String deliveryId;

    /**
     * 订单ID
     */
    @Column("order_id")
    @Schema(description = "订单ID")
    private String orderId;

    /**
     * 状态（0、未完成；1、已完成；）
     */
    @Column(value = "state",onInsertValue = "0")
    @Schema(description = "状态（0、未完成；1、已完成；）")
    private Integer state;

    /**
     * 类型（0、订单支付；1、充值储蓄；2、提现；3：分销商返利；4：成为分销商；5、推广储蓄返利；6：绑定手机号）
     */
    @Column("type")
    @Schema(description = "类型（0、订单支付；1、充值储蓄；2、提现；3：分销商返利；4：成为分销商；5、推广储蓄返利；6：绑定手机号）")
    private Integer type;

    /**
     * 金额
     */
    @Column("money")
    @Schema(description = "金额")
    private Double money;

    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "create_time",onInsertValue = "now()")
    @Schema(description = "创建时间")
    private Date createTime;

    /***
     * 流入方向（0、流入；1、流出）
     */
    @Column("inflow_direction")
    @Schema(description = "流入方向（0、流入；1、流出）")
    private Integer inflowDirection;

    /***
     * 流入方式（0：支付；1：积分）
     */
    @Column("inflow_way")
    @Schema(description = "流入方式（0：支付；1：积分）")
    private Integer inflowWay;

    /***
     * 积分
     */
    @Column("integral")
    @Schema(description = "积分")
    private Integer integral;

}
